package models

import (
	"crypto/md5"
	"fmt"
	"github.com/jinzhu/gorm"
)

// UserInfo 用户登录信息
type UserInfo struct {
	gorm.Model
	Username string `gorm:"type:varchar(50);not null;"`
	Password string `gorm:"type:varchar(50);not null;"`
	Img      string `gorm:"type:varchar(255);not null;"`
}

func Resister(password string) string {
	//密码加密方法一
	m5 := []byte(password)
	has := md5.Sum(m5)
	md5str1 := fmt.Sprintf("%x", has) //将[]byte转成16进制
	return md5str1
}
